package com.mashibing.servicedriveruser.controller;

import com.mashibing.servicedriveruser.service.CarService;
import org.mashibing.dto.Car;
import org.mashibing.dto.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author:
 * @create: 2024/6/27 15:41
 * @description:
 */
@RestController
public class CarController {

    @Autowired
    private CarService carService;

    /**
     * 新增车辆信息
     */
    @PostMapping("/car")
    public ResponseResult addCar(@RequestBody Car car) {
        return carService.addCar(car);
    }

    /**
     * 根据车辆ID查询车辆信息
     */
    @GetMapping("/car")
    public ResponseResult<Car> getCarById(Long carId){

        return carService.getCarById(carId);
    }
}
